import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EmgPlanVO, EmgPlanForm, EmgPlanQuery } from '@/api/biz/emgPlan/types';

/**
 * 查询应急预案列表
 * @param query
 * @returns {*}
 */

export const listEmgPlan = (query?: EmgPlanQuery): AxiosPromise<EmgPlanVO[]> => {
  return request({
    url: '/biz/emgPlan/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询应急预案详细
 * @param id
 */
export const getEmgPlan = (id: string | number): AxiosPromise<EmgPlanVO> => {
  return request({
    url: '/biz/emgPlan/' + id,
    method: 'get'
  });
};

/**
 * 新增应急预案
 * @param data
 */
export const addEmgPlan = (data: EmgPlanForm) => {
  return request({
    url: '/biz/emgPlan',
    method: 'post',
    data: data
  });
};

/**
 * 修改应急预案
 * @param data
 */
export const updateEmgPlan = (data: EmgPlanForm) => {
  return request({
    url: '/biz/emgPlan',
    method: 'put',
    data: data
  });
};

/**
 * 删除应急预案
 * @param id
 */
export const delEmgPlan = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz/emgPlan/' + id,
    method: 'delete'
  });
};
